package org.ucas.faker.web.fetcher.op;

import org.ucas.faker.web.fetcher.meta.ColumnField;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class GroupBy  implements Serializable {

  public List<ColumnField> columns = new ArrayList<>();

  public void add(ColumnField column) {
    columns.add(column);
  }

  public String sql() {
    return "GROUP BY " + columns.stream().map(ColumnField::sql).collect(Collectors.joining(","));
  }
}
